<template>
    <div>
        <div class="crumbs">
            <el-breadcrumb separator="/">
                <el-breadcrumb-item>
                    <i class="el-icon-lx-calendar"></i> 公告
                </el-breadcrumb-item>
                <el-breadcrumb-item>发布公告</el-breadcrumb-item>
            </el-breadcrumb>
        </div>
        <div class="container">
            <div class="form-box">
                <el-form ref="form" label-width="80px">
                    <el-form-item label="公告标题">
                        <el-input v-model="param.annotitle"></el-input>
                    </el-form-item>
                    <el-form-item label="文本框">
                        <el-input type="textarea" rows="5" v-model="param.annocontent"></el-input>
                    </el-form-item>
                    <el-form-item>
                        <el-button type="primary" @click="onSubmit">发布公告</el-button>
                        <el-button>取消</el-button>
                    </el-form-item>
                </el-form>
            </div>
        </div>
    </div>
</template>

<script>
    import {updateAnno} from "../../api/admin";

    export default {
        //name: 'baseform',
        data() {
            return {
                param: {
                    annotitle: '',
                    // delivery: true,
                    annocontent: ''
                }
            };
        },
        methods: {
            onSubmit() {
                updateAnno(this.param).then(res => {
                    console.log(res);
                    if (res.state==2000) {
                        this.$message.success('发布成功！');
                        this.param.annotitle='';
                        this.param.annocontent='';
                        location.reload();
                    }else{
                        this.$message.error(res.message);
                    }

                })
            }
        }
    };
</script>
